<template>
	<uni-popup ref='popup' type="center" border-radius="10px">
		<view class="gl-popup-view">
			<view class="gl-popup-title">
				<view class=""> {{title}} </view>
				<uni-icons class="gl-button-mini gl-button-error" type="closeempty" size="18" color="#fff"
					@tap="EventClose"></uni-icons>
			</view>
			<view class="gl-popup-body" style="display: flex;flex-direction: column;gap: 5px;">
				<scroll-view scroll-y="true" style="max-height: 40vh;">
					<view v-for="(value, key) in curData" :key="key">
						<text style="font-weight: bold;">{{ key }}:</text>
						<text :selectable="true" style="margin-left: 10px;">{{ value }}</text>
					</view>
				</scroll-view>
			</view>
			<view class="gl-popup-foot" style="display: flex;justify-content: flex-end;gap: 10px;">
				<view class="gl-button gl-button-base" @tap="EventSync">
					<uni-icons type="checkmarkempty" size="18" color="#fff"></uni-icons>
					<text style="font-size: small;">同步</text>
				</view>
				<view class="gl-button gl-button-warning" @tap="EventClose">
					<uni-icons type="closeempty" size="18" color="#fff"></uni-icons>
					<text style="font-size: small;">取消</text>
				</view>
			</view>
		</view>
	</uni-popup>
</template>

<script>
	import psMethod from '@/common/psMethod';
	export default {
		data() {
			return {
				title: 'SPU远程数据',
				sConf: getApp().globalData,
				spu: null,
				testData: {
					spu_id: 111,
					spu_name: 'aaa'
				},
				curData: {
					"spu_id": 1134857,
					"supplier_id": 741,
					"channel_id": 0,
					"brand_id": 2039,
					"class_id": "1242",
					"image": "https://img.zhenxinhuixuan.com/image/20250406/e30fde7c11f47b3e391b5be29f2d30c0.jpg",
					"slider_image": [
						"https://img.zhenxinhuixuan.com/slider_image/20250406/ef2d8fcbd6c048bbe0581d876faca43d.jpg",
						"https://img.zhenxinhuixuan.com/slider_image/20250406/9756b8d8fef4e2970840a46c7c70bf2f.jpg",
						"https://img.zhenxinhuixuan.com/slider_image/20250406/cab3e18319f7b636dcdd1d04b0d857df.jpg"
					],
					"store_name": "YSL圣罗兰自由之水50ml（保税仓直发）",
					"store_info": "适合各种场合，无论是日常使用还是特殊节日礼物，都能展现出女性的独立、自信与优雅。其独特的香调和优雅的瓶身设计使其成为表达爱意、赠予挚爱的完美选择‌",
					"thirdparty_link": null,
					"spec_type": 0,
					"spu": null,
					"code": "P741113485717439069065712895",
					"keyword": "YSL圣罗兰自由之水50ml（保税仓直发）",
					"unit_name": "件",
					"price": "339.20",
					"market_price": "576.00",
					"group_price": "499.00",
					"rate": "69.81",
					"type": "1",
					"status": 2,
					"is_overseas": 0,
					"source_supply": null,
					"info": null,
					"channel_name": null,
					"type_name": "优选自营",
					"after_sale": {
						"after_sale": "1.产品有质量或其它问题请在签收48小时之内上报客服，快递面单+产品图片+视频反馈给售后客服处理。\r\n 2.退换货处理，凡是未拆封，在不影响二次销售情况下可退换货。\r\n 3.本司原则上是不支持7天无理由退货换的，除非产品质量问题可退货（退货运费险8元/单）\r\n4.拦截或拒收需要扣快递费4元",
						"delivery_time": "24-72小时内发货",
						"special_version": "保税仓一般贸易发货，产品是全球各地生产后直接进口，海关保税仓发货，非国内专柜版本，（非质量问题，不予退换）产品属于一般贸易，都是资质链路完整，请放心使用。保税仓直接发货，无中间商，所以价格实惠。",
						"delivery_expressage": "中通，韵达"
					},
					"category": {
						"name": "香水",
						"parent_id": 690
					},
					"brand": {
						"name": "YSL圣罗兰",
						"class_id": "745,756,757,758,764,1242,2324,847,1161,1165,1172",
						"thumbnail_img": ""
					},
					"sku": [{
						"sku_id": 4204099,
						"suk": "50ml",
						"sku": "SU741C690P0A1R6179",
						"attr": [{
							"name": "规格",
							"value": "50ml"
						}],
						"stock": 999,
						"price": "339.20",
						"image": "",
						"bar_code": "0091",
						"market_price": "576.00",
						"group_price": "499.00",
						"weight": 0,
						"volume": "0",
						"is_show": 1,
						"buy_start_qty": 1,
						"service_price": 3.39,
						"skuDesc": {
							"skuname": "YSL圣罗兰自由之水50ml（保税仓直发）",
							"description": "<p><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151222305/d9aa62a2c15749d16ba3b0d14c003025.jpg\" title=\"/ueditor/image/20250406/1743907151222305/d9aa62a2c15749d16ba3b0d14c003025.jpg\" alt=\"09f73c2809bebb91827bbf09de017799.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151218787/2323e82ffe68ac5bbff928e1eca182b4.jpg\" title=\"/ueditor/image/20250406/1743907151218787/2323e82ffe68ac5bbff928e1eca182b4.jpg\" alt=\"7b45f021d2cf31c4f57ff17221406f03.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151822326/e90bc8d73f91530265b38ddb26714cc5.jpg\" title=\"/ueditor/image/20250406/1743907151822326/e90bc8d73f91530265b38ddb26714cc5.jpg\" alt=\"5fbabe48108d83149c47d59111d0fd4e.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151442281/a64bd2ccd1cd9c1fdb267df6d8aceab3.jpg\" title=\"/ueditor/image/20250406/1743907151442281/a64bd2ccd1cd9c1fdb267df6d8aceab3.jpg\" alt=\"3a2838fb30a7c3ab1238ddceaeb676c0.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151331068/0fe801c4f0c92de2037a6efe9fc54e23.jpg\" title=\"/ueditor/image/20250406/1743907151331068/0fe801c4f0c92de2037a6efe9fc54e23.jpg\" alt=\"1cc3a7bd4b5f312d3622451c8743aa3b.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151837514/887fe700519611d7f3948b0afc9c08ed.jpg\" title=\"/ueditor/image/20250406/1743907151837514/887fe700519611d7f3948b0afc9c08ed.jpg\" alt=\"1.jpg\"/></p><p><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907165367520/fb28ac446165c3d4bb427b4880593d84.jpg\" title=\"/ueditor/image/20250406/1743907165367520/fb28ac446165c3d4bb427b4880593d84.jpg\" alt=\"707d1b6e8628377368268dd5285f0d4b.jpg\"/></p><p><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907186304894/60edb0c0f7dd8da68c9333cdacb33c10.jpg\" title=\"/ueditor/image/20250406/1743907186304894/60edb0c0f7dd8da68c9333cdacb33c10.jpg\" alt=\"c83d6ebdfb3da9f2c9c98b5fbef9002c.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907186522644/8b6b4e7e269c9b7de36f076ca5d790e1.jpg\" title=\"/ueditor/image/20250406/1743907186522644/8b6b4e7e269c9b7de36f076ca5d790e1.jpg\" alt=\"a301bffc5f0d706e9fcf8bfa7ec46b81.jpg\"/></p><p><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907200311852/af7d35dba51fa2e273e2eb2a6426d037.png\" title=\"/ueditor/image/20250406/1743907200311852/af7d35dba51fa2e273e2eb2a6426d037.png\" alt=\"fef79a724e7a9094cc682bd43d47b3c5.png\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907201708838/927860ce5b062bac59952360c70403a4.jpg\" title=\"/ueditor/image/20250406/1743907201708838/927860ce5b062bac59952360c70403a4.jpg\" alt=\"f3f35657a262418f84ec692aeb83ce4c.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907201319077/31f773bdccc2fb998380c222fd2437c9.jpg\" title=\"/ueditor/image/20250406/1743907201319077/31f773bdccc2fb998380c222fd2437c9.jpg\" alt=\"d787392c39f9b05d7deb635c90da3112.jpg\"/></p><p><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907227952474/e60c419e181be17eab1b45666462d5a5.png\" title=\"/ueditor/image/20250406/1743907227952474/e60c419e181be17eab1b45666462d5a5.png\" alt=\"香水售后问答.png\"/></p>"
						}
					}],
					"attr_result": {
						"attrs": {
							"规格": "50ml"
						},
						"attr": [{
							"value": "规格",
							"detail": [
								"50ml"
							]
						}]
					},
					"description": "<p><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151222305/d9aa62a2c15749d16ba3b0d14c003025.jpg\" title=\"/ueditor/image/20250406/1743907151222305/d9aa62a2c15749d16ba3b0d14c003025.jpg\" alt=\"09f73c2809bebb91827bbf09de017799.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151218787/2323e82ffe68ac5bbff928e1eca182b4.jpg\" title=\"/ueditor/image/20250406/1743907151218787/2323e82ffe68ac5bbff928e1eca182b4.jpg\" alt=\"7b45f021d2cf31c4f57ff17221406f03.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151822326/e90bc8d73f91530265b38ddb26714cc5.jpg\" title=\"/ueditor/image/20250406/1743907151822326/e90bc8d73f91530265b38ddb26714cc5.jpg\" alt=\"5fbabe48108d83149c47d59111d0fd4e.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151442281/a64bd2ccd1cd9c1fdb267df6d8aceab3.jpg\" title=\"/ueditor/image/20250406/1743907151442281/a64bd2ccd1cd9c1fdb267df6d8aceab3.jpg\" alt=\"3a2838fb30a7c3ab1238ddceaeb676c0.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151331068/0fe801c4f0c92de2037a6efe9fc54e23.jpg\" title=\"/ueditor/image/20250406/1743907151331068/0fe801c4f0c92de2037a6efe9fc54e23.jpg\" alt=\"1cc3a7bd4b5f312d3622451c8743aa3b.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907151837514/887fe700519611d7f3948b0afc9c08ed.jpg\" title=\"/ueditor/image/20250406/1743907151837514/887fe700519611d7f3948b0afc9c08ed.jpg\" alt=\"1.jpg\"/></p><p><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907165367520/fb28ac446165c3d4bb427b4880593d84.jpg\" title=\"/ueditor/image/20250406/1743907165367520/fb28ac446165c3d4bb427b4880593d84.jpg\" alt=\"707d1b6e8628377368268dd5285f0d4b.jpg\"/></p><p><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907186304894/60edb0c0f7dd8da68c9333cdacb33c10.jpg\" title=\"/ueditor/image/20250406/1743907186304894/60edb0c0f7dd8da68c9333cdacb33c10.jpg\" alt=\"c83d6ebdfb3da9f2c9c98b5fbef9002c.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907186522644/8b6b4e7e269c9b7de36f076ca5d790e1.jpg\" title=\"/ueditor/image/20250406/1743907186522644/8b6b4e7e269c9b7de36f076ca5d790e1.jpg\" alt=\"a301bffc5f0d706e9fcf8bfa7ec46b81.jpg\"/></p><p><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907200311852/af7d35dba51fa2e273e2eb2a6426d037.png\" title=\"/ueditor/image/20250406/1743907200311852/af7d35dba51fa2e273e2eb2a6426d037.png\" alt=\"fef79a724e7a9094cc682bd43d47b3c5.png\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907201708838/927860ce5b062bac59952360c70403a4.jpg\" title=\"/ueditor/image/20250406/1743907201708838/927860ce5b062bac59952360c70403a4.jpg\" alt=\"f3f35657a262418f84ec692aeb83ce4c.jpg\"/><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907201319077/31f773bdccc2fb998380c222fd2437c9.jpg\" title=\"/ueditor/image/20250406/1743907201319077/31f773bdccc2fb998380c222fd2437c9.jpg\" alt=\"d787392c39f9b05d7deb635c90da3112.jpg\"/></p><p><img src=\"https://img.zhenxinhuixuan.com/ueditor/image/20250406/1743907227952474/e60c419e181be17eab1b45666462d5a5.png\" title=\"/ueditor/image/20250406/1743907227952474/e60c419e181be17eab1b45666462d5a5.png\" alt=\"香水售后问答.png\"/></p>"
				}



			}
		},
		methods: {
			open(e) {
				this.curData = null
				this.spu = e
				this.EventRemote()
				this.$refs.popup.open()
			},
			EventClose() {
				// this.curData = null
				this.$refs.popup.close()
			},
			/**
			 * 远程查看		
			 */
			EventRemote() {
				let token = this.sConf.auth.token || '';
				let data = {
					spu_id: this.spu
				}
				uni.showLoading({
					title: '加载中'
				})
				psMethod.syncAuthenticatorRequest('/admin/showSpu/', 'POST', token, data).then(res => {
					console.log('查看远程SPU->', res);
					if (res.resmsg.code === 200) {
						this.curData = res.resmsg.data
					}
				}).finally(() => {
					uni.hideLoading()
				})
			},
			/**
			 * 远程同步			
			 */
			EventSync() {
				console.log('EventSync');
				let that = this
				let token = this.sConf.auth.token || '';
				let data = {
					spu_id: this.spu
				}
				uni.showLoading({
					title: '加载中'
				})
				psMethod.syncAuthenticatorRequest('/admin/syncSpu/', 'POST', token, data).then(res => {
					console.log('同步远程SPU->', res);
					uni.showToast({
						title: '提交成功',
						success() {
							that.EventClose()
						}
					})
				}).finally(() => {
					uni.hideLoading()
				})
			},
		}
	}
</script>

<style>

</style>